export function timeComparison(timestamp) {
    const currentTime = Date.now();
    const timeDiff = currentTime - timestamp;
    const oneMinute = 60 * 1000;
    const oneHour = 60 * oneMinute;
    const oneDay = 24 * oneHour;
    const oneMonth = 30 * oneDay; // 这里假设一个月为 30 天，实际应用中可以根据需求精确计算
    const threeMonths = 3 * oneMonth;

    if (timeDiff <= oneMinute) {
        return "1分钟内";
    } else if (timeDiff <= oneHour) {
        const minutes = Math.floor(timeDiff / oneMinute);
        return `${minutes}分钟`;
    } else if (timeDiff <= oneDay) {
        const hours = Math.floor(timeDiff / oneHour);
        return `${hours}小时`;
    } else if (timeDiff <= oneMonth) {
        const days = Math.floor(timeDiff / oneDay);
        return `${days}天`;
    } else if (timeDiff <= threeMonths) {
        const months = Math.floor(timeDiff / oneMonth);
        return `${months}个月`;
    } else {
        return "3个月";
    }
}

export function gotoHome(){
	
	uni.showModal({
		title:"提示",
		content:"页面有误，将返回首页",
		showCancel:false,
		success: (res) => {
			uni.reLaunch({
				url:"/pages/index/index"
			})
		}
	})
	
}